<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
  </head>
  
  <body>
    <div class="easyui-layout" fit="true" style="height:100%;">
		<div data-options="region:'north'"  >
		    <input name="codition" id="ss" class="easyui-searchbox"
				searcher="searchhelpinfotable" prompt="请输入皮肤编号"
				style="width:130px;vertical-align:middle;"></input>
	    </div>
		<%-- 表格数据区域 --%>
		<div region="center" border="false">
			<table id="helpinfotable" ></table>
		</div>
	</div>
	<script type="text/javascript">

		//查询商品的方法

		
		function searchhelpinfotable(value,name){
			$("#helpinfotable").edatagrid({
				url:"backadmin/helpinfo.action?op=findallhelpinfo",
			    saveUrl: "backadmin/helpinfo.action?op=addhelpinfo",
			    updateUrl: "backadmin/helpinfo.action?op=updatehelpinfo",
			    idField:"hiid",
				pagination:true,
				pageNumber:1,
				pageSize:10,
				pageList:[10,20,30,40,50],
				fit:true,
				rownumbers:true,
				sortName:"hiid",
				title:"帮助信息管理表",
				sortOrder:"desc",
				fitColumns:true,
				singleSelect:true,
				queryParams:{
					fname:value
				},
				columns:[[
					{field:"hiid",title:"帮助信息编号",width:100,align:"center"},
					{field:"hititle",title:"帮助信息标题",width:100,align:"center",editor:'text'},
					{field:"hicontent",title:"帮助信息内容",width:100,align:"center",editor:'text'},
					{field:"histatus",title:"帮助信息状态",width:100,align:"center",editor:'text',
						formatter:function(value,rec){
							if(value==1){
								return "<font color='green'>有效</font>";
							}else{
								return "<font color='red'>无效</font>";
							}
						}
							
					}
				]],
				onLoadSuccess:function(data){
					$("#helpinfotable").edatagrid("fitColumns");//修复不对齐的bug
				},
				onAfterEdit:function(data){//编辑后修改linkbutton
					
				},
				toolbar:[
				         {
				        	 iconCls:'icon-add',
				        	 text:"添加",
				        	 handler:function(){
				        		 $("#helpinfotable").edatagrid('addRow');
				        	 }
				         },{
				        	 iconCls:'icon-add',
				        	 text:"删除",
				        	 handler:function(){
				        		var row = $('#helpinfotable').datagrid('getSelected');
				        		var rowinfo= $('#helpinfotable').datagrid('getSelections');
				     			if (row) {
				     			         var rowIndex = $('#helpinfotable').datagrid('getRowIndex', row);
				     			       	 $('#helpinfotable').datagrid('deleteRow', rowIndex);  
				     			         // 发送异步请求
				     			         $.ajax({
				     			        	 url:"backadmin/taskType.action?op=deleteTaskType",
				     			        	 type:"POST",
				     			        	 data:{"ttid":rowinfo[0]},
				     			        	 dataType:"JSON",
				     			        	 success:function(data){
				     			        		 if(data.code==1){
					     			        		 $('#helpinfotable').datagrid('reload');//删除后重新加载下
				     			        		 }else{
				     			        			 showinfobox("1","",data.msg);
				     			        			 $('#helpinfotable').datagrid('reload');
				     			        		 }
				     			        	 }
				     			         });
				     			        
				     			 } 
				        	 }
				         },{
				        	 iconCls:'icon-save',
				        	 text:"保存",
				        	 handler:function(){
				        		 $("#helpinfotable").edatagrid('saveRow');//完成添加或更新
				        	 }
				         },{
				        	 iconCls:'icon-undo',
				        	 text:"取消编辑",
				        	 handler:function(){
				        		 $("#helpinfotable").edatagrid('cancelRow');
				        	 }
				  		  }
				  ]
			});
		}
		
		$(function(){
			searchhelpinfotable(null,null);
			
		});
	</script>
  </body>
</html>
